import { filterTree } from "@/utils";
// 没什么用
export default {
  data() {
    return {};
  },
  mounted() {},
  // 被 keep-alive 缓存的组件激活时调用。
  activated() {},

  beforeDestroy() {},
  // 被 keep-alive 缓存的组件失活时调用。
  deactivated() {},
  methods: {
    channelQuery() {
      new Promise((resolve, reject) => {
        let arr = filterTree(this.siteListCache[0], this.filterName, [
          "channelId",
          "name",
        ]);
        console.log("arr: ", arr);

        this.siteList = [arr];
        if (!arr) {
          this.siteList = [this.siteRow];
          this.siteList[0].children = [];
        }

        this.leftTableLoading = false;

        resolve();
        this.$nextTick(() => {});
      }).then(() => {
        //展开第一个节点
        // this.columnRow = undefined;
        this.$store.dispatch("column/setColumnRow", null);
        //展开第一个节点
        this.siteList[0] &&
          this.$refs.xTree.setTreeExpand(this.siteList[0], true);
        //展开所有节点
        // this.$refs.xTree.setAllTreeExpand(true);
        this.columnRow && this.$refs.xTree.setCurrentRow(this.columnRow);
        this.siteList[0]?.children &&
          this.$refs.xTree.setCurrentRow(this.siteList[0].children[0]);
        this.$nextTick(() => {
          this.tour.$refs.tour.$refs.vtour.nextStep();
        });
      });
    },
  },
};
